package w2

object FuncParam {
  def main(args: Array[String]): Unit = {
    println(func1("你好", age = 22))
    println(func1("你好", name = "晋西南"))

    //int i=100
    //pascal
    val a: Int = 100

    println(chengi(1, 2, 4, 6, 8, 10))
    println(chengi(11, 20))
    println(chengi(11))
    println(chengi())
  }

  def func1(str: String, name: String = "Rose", age: Int = 18) = str + name + age

  def chengi(k: Int*): Long = {
    if (k.length < 1) {
      return 0
    }

    var s: Long = 1
    for (i <- k) s *= i
    s
  }

  def chengi2(p: Int, k: Int*): Long = {

    var s: Long = p
    for (i <- k) s *= i
    s
  }
}
